页面树结构
转至元数据结尾
转至元数据起始

FR提供了多种方式的集成, 以便于客户在移动端查看预览模板. 其中包括:  原生模板预览, 原生APP预览.  首先我们来配置工程进行引用.

第一步: 创建并配置工程,  (具体方法参见工程配置部分)  如果已下载了FR提供的集成AppDemo, 使用IDEA直接OPEN工程即可. 

 

      下载地址:https://dn-finereportmobiledemo.qbox.me/android.html?v=1453428447083

     (ps:后面的v后面接的是时间戳参数,避免页面缓存影响,请将v=后面的时间戳参数换成下载时的最新时间)

 

第二步: 在AndroidManifest中配置所需权限等信息

  1.  SDK 版本 FR支持4.0+的版本
    <uses-sdk android:minSdkVersion="14"/>

     

  2. 添加权限信息 

    <!-- frandroid 相关权限 写入开始 -->

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="ANDROID.PERMISSION.BIND_VPN_SERVICE"/>
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.BROADCAST_STICKY"/>
    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
    <uses-feature android:name="android.hardware.camera"/>
    <uses-feature android:name="android.hardware.camera.autofocus"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <!-- 支持iBeancon 需要蓝牙权限 -->
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <!-- 支持个推3.0 电子围栏功能 -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <!-- 浮动通知权限 -->
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />


    <!-- 【必须】 信鸽SDK所需权限 开始 -->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.RESTART_PACKAGES"/>
    <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
    <uses-permission android:name="android.permission.GET_TASKS"/>
    <uses-permission android:name="android.permission.READ_LOGS"/>
    <!-- 【必须】 信鸽SDK所需权限 结束 -->

    <!-- frandroid 相关权限 写入结束 -->

     

  3.  在Activity引用中, 加入FR相关Activity
    <!-- frandroid 相关activity设置写入开始 -->
    <activity android:name="com.fr.android.parameter.ui.widget.core.IFTextScanActivity"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="sensorPortrait"
     android:theme="@android:style/Theme.NoTitleBar"
     />
    <activity android:name="com.fr.android.parameter.ui.widget.core.IFTextScanHorizontalActivity"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="sensorLandscape"
     android:theme="@android:style/Theme.NoTitleBar"
     />

    <activity
     android:name="com.fr.android.form.IFFormActivity"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:windowSoftInputMode="stateHidden|adjustResize"
     android:configChanges="orientation|keyboardHidden|screenSize"/>
    <activity
     android:name="com.fr.android.form.IFFormActivity4BI"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:windowSoftInputMode="stateHidden|adjustResize"
     android:configChanges="orientation|keyboardHidden|screenSize"/>
    <activity android:name="com.fr.android.report.IFReportActivity"
     android:configChanges="orientation|screenSize|keyboardHidden"
     android:windowSoftInputMode="stateHidden|adjustResize"
     android:theme="@style/IFTheme"
     />
    <activity android:name="com.fr.android.report.IFReportActivityWithPath"
     android:configChanges="orientation|screenSize|keyboardHidden"
     android:windowSoftInputMode="stateHidden|adjustResize"
     android:theme="@style/IFTheme"
     />
    <activity android:name="com.fr.android.form.IFFormActivityWithPath"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:windowSoftInputMode="stateHidden|adjustResize"
     android:configChanges="orientation|keyboardHidden|screenSize"/>

    <activity android:name="com.fr.android.report.IFWebViewActivity"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:configChanges="orientation|screenSize|keyboardHidden"
     />
    <activity android:name="com.fr.android.chart.Gallery3DActivity"/>
    <activity android:name="com.fr.android.report.IFGalleryActivity"
     android:screenOrientation="sensorPortrait"
     android:theme="@android:style/Theme.Translucent.NoTitleBar"
     />
    <activity android:name="com.fr.android.report.IFGalleryActivityHorizontal"
     android:screenOrientation="sensorLandscape"
     android:theme="@android:style/Theme.Translucent.NoTitleBar"
     />
    <activity android:name="com.fr.android.report.IFShareActivity"
     android:theme="@style/NoAnimationTheme"
     android:screenOrientation="sensorPortrait"/>
    <activity android:name="com.fr.android.report.IFShareActivityHorizontal"
     android:theme="@style/NoAnimationTheme"
     android:screenOrientation="sensorLandscape"/>
    <activity android:name="com.fr.android.app.activity.IFConfigActivity"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:screenOrientation="sensorPortrait"/>
    <activity android:name="com.fr.android.app.activity.IFConfigActivity4Pad"
     android:theme="@android:style/Theme.Translucent.NoTitleBar"
     android:screenOrientation="sensorLandscape"/>
    <activity
     android:name="com.fr.android.app.contents.IFMainPage"
     android:alwaysRetainTaskState="true"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>

    <activity android:name="com.fr.android.app.offline.ui.IFTempStoragePage"
     android:screenOrientation="sensorPortrait"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>
    <activity android:name="com.fr.android.app.offline.ui.IFTempStoragePage4Pad"
     android:screenOrientation="sensorLandscape"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>
    <activity android:name="com.fr.android.app.push.IFNotificationHandler"
     android:theme="@style/TransparentTheme"/>

    <activity android:name="com.fr.android.app.activity.IFLoginZY"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"></activity>

    <activity android:name="com.fr.android.app.activity.IFLoginZY4Pad"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"></activity>

    <activity
     android:name="com.fr.android.app.activity.IFServerPage4Pad"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="landscape"
     android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
     android:name="com.fr.android.app.activity.IFWelcome4Phone"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
     android:name="com.fr.android.app.activity.IFWelcome4Pad"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="landscape"
     android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
     android:name="com.fr.android.app.contents.IFMainPage4Pad"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="landscape"
     android:theme="@style/IFTheme"/>
    <activity
     android:name="com.fr.android.app.activity.IFServerPage"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
     android:name="com.fr.android.app.activity.IFDeviceActivity"
     android:exported="true"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
     android:name="com.fr.android.app.activity.IFDeviceActivity4Pad"
     android:exported="true"
     android:screenOrientation="landscape"
     android:theme="@style/TransparentTheme"/>

    <activity
     android:name="com.fr.android.app.activity.IFAboutActivity4Pad"
     android:exported="true"
     android:screenOrientation="landscape"
     android:theme="@style/TransparentTheme"/>
    <activity
     android:name="com.fr.android.app.activity.IFAboutActivity4Phone"
     android:exported="true"
     android:screenOrientation="portrait"
     android:theme="@style/TransparentTheme"/>
    <activity
     android:name="com.fr.android.app.activity.IFAddServer4Phone"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.NoTitleBar"/>
    <activity
     android:name="com.fr.android.app.activity.IFAddServer4Pad"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:screenOrientation="landscape"
     android:theme="@android:style/Theme.NoTitleBar"/>

    <activity android:name="com.fr.android.ui.imageupload.IFImageSelectActivity"
     android:theme="@style/IFTheme"/>
    <activity android:name="com.fr.android.ui.imageupload.IFImageSelectActivity4Pad"
     android:screenOrientation="sensorLandscape"/>

    <activity android:name="com.fr.android.ui.imageupload.IFSelectChooseActivity"
     android:configChanges="orientation|keyboardHidden"
     android:exported="true"
     android:theme="@style/TransparentTheme"/>

    <activity android:name="com.fr.android.ui.imageupload.IFSelectChooseActivity4Pad"
     android:screenOrientation="sensorLandscape"/>

    <activity android:name="com.fr.android.activity.LoadAppFromURLActivity"
     android:exported="true"/>
    <activity
     android:name="com.fr.android.activity.LoadAppFromWelcomeActivity"
     android:theme="@android:style/Theme.NoTitleBar"
     android:exported="true"/>

    <activity
     android:name="com.fr.android.tools.BugReportActivity"
     android:theme="@android:style/Theme.NoTitleBar"/>

    <activity
     android:name="com.fr.android.bi.FineBIViewController"
     android:hardwareAccelerated="false"
     android:theme="@android:style/Theme.Holo.Light"
     android:configChanges="orientation|keyboardHidden|screenSize"
     android:label="@string/app_name" >
    </activity>
    <activity
     android:name="com.fr.android.bi.LinkController"
     android:configChanges="orientation|keyboardHidden|screenSize"
     android:label="@string/app_name" >
    </activity>

    <activity android:name="com.fr.android.app.activity.IFChangePasswordActivity"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>
    <activity android:name="com.fr.android.app.activity.IFChangePasswordActivity4Pad"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:screenOrientation="sensorLandscape"/>
    <activity android:name="com.fr.android.ui.gesturelock.IFGestureLockActivity"
     android:theme="@android:style/Theme.Holo.Light"/>

    <activity android:name="com.fr.android.vpn.IFVPNPage"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"/>
    <activity android:name="com.fr.android.vpn.IFVPNPage4Pad"
     android:theme="@android:style/Theme.Holo.Light.NoActionBar"
     android:windowSoftInputMode="stateHidden|adjustResize"/>

    <service android:name="com.fr.android.app.activity.IFUpdateService"></service>

     

第三步:  在应用程序创建时初始化 SDK引用的Context 全局变量

         FRSDK.initSDK(context)
 

第四步:  创建新的Activity, 直接通过URL 原生预览模板.

 

 

 
public class TestLoadUrlActivity extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 Intent intent = new Intent();
 intent.putExtra("url","http://www.finereporthelp.com:8889/app/ReportServer?reportlet=app/DetailedDrillA-phone.cpt&op=write");
 intent.putExtra("title", "My Title");
 intent.setClass(this, LoadAppFromURLActivity.class);
 startActivity(intent);
}
}

第五步:  创建新Activity, 通过登录访问模板

public class TestLoginActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 IFOEMUtils.setUseGuidePage(true); // 在第一次安装加载时, 是否启用引导页.
 Intent welcomeIntent = new Intent(this, LoadAppFromWelcomeActivity.class);

 welcomeIntent.putExtra("username", "demo"); // 数据决策系统 用户名
 welcomeIntent.putExtra("password", "demo"); // 数据决策系统 用户密码
 welcomeIntent.putExtra("serverIp", "http://www.finereporthelp.com:8889/app/ReportServer"); // 数据决策系统 地址ip
 welcomeIntent.putExtra("serverName", "demo服务器"); // 数据决策系统 名称

 startActivity(welcomeIntent);

}
}

 


 

 

 

 

  • 无标签