Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/143.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在Android startup上启动Flex移动应用程序_Java_Android_Actionscript 3_Apache Flex_Air Native Extension - Fatal编程技术网

Java 在Android startup上启动Flex移动应用程序

Java 在Android startup上启动Flex移动应用程序,java,android,actionscript-3,apache-flex,air-native-extension,Java,Android,Actionscript 3,Apache Flex,Air Native Extension,我在android startup上启动应用程序时遇到了一个问题,问题是如何将侦听器从清单(在Flash builder的移动应用程序项目上)放到本机扩展中的“android.permission.RECEIVE_BOOT_COMPLETED”上 基本上在舱单上我有这样的东西: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <application>

我在android startup上启动应用程序时遇到了一个问题,问题是如何将侦听器从清单(在Flash builder的移动应用程序项目上)放到本机扩展中的“android.permission.RECEIVE_BOOT_COMPLETED”上

基本上在舱单上我有这样的东西:

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application>
       <receiver android:enabled="true" android:name="EXTENSION_PACKAGE.application.receivers.ApplicationStartupReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
       </receiver>
    </application>
我的问题是:

  • “EXTENSION_PACKAGE”是来自本机项目的包名还是扩展id
  • “.application”指的是应用程序还是我不需要它
我希望你能理解这种情况,并提前向你表示感谢

---------------------------------------编辑------------------------------------------

经过几次尝试和测试后,我更改了这些值:

<receiver android:enabled="true" android:name="NATIVEPROJECTPACKAGE.application.receiver.ApplicationStartupReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
现在它似乎可以工作了,现在唯一的问题是它在android启动时崩溃了,我收到一个警告说:“不幸的是,应用程序‘应用程序名称’已经停止了”
当然,如果我启动该应用程序,它会工作,…

首先只需再次检查您是否使用了正确的包名,因为您已将包列为扩展包,然后将application.receivers添加到清单中的定义中。它可能应该如下所示:

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application>
   <receiver android:enabled="true" android:name="EXTENSION_PACKAGE.ApplicationStartupReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
   </receiver>
</application>

据我所知,在您的广播接收器中,您正在接收启动信息,并启动了一项服务,您现在需要什么?很抱歉,如果我错过了要点,那么我无法为BOOT_COMPLETED设置接收器,因为清单在flex应用程序上,而侦听器本身在本机端,因为我们不能使用flex,只是一个问题,我在“/.AppEntry”中输入了mxlm文件的名称,对吗?问题是我在重新启动设备后收到了这个错误消息:很遗憾,应用程序“…”停止了。不,保持上面的代码不变,不要更改“/.AppEntry”。此代码正在为包含上下文的应用程序确定正确的入口点,因此您不需要更改任何内容。我遇到的问题是否可能是因为侦听器正在工作,但我在构建ANE时犯了一个错误,因此它找不到接收器?听着,我有本机项目的包,来自本机扩展的le包,以及我放入
ExtensionContext.createExtensionContext(,)中的包
这也是extension.xml中的ID,对吗?这里的扩展包是哪一个?我在舱单上放进了接收者?
Intent serviceIntent = new Intent("air.APPLICATION_ID"); // from the APPLICATION.XML
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application>
   <receiver android:enabled="true" android:name="EXTENSION_PACKAGE.ApplicationStartupReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
   </receiver>
</application>
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
{
    String componentName = context.getPackageName() + "/.AppEntry";
    Intent i = new Intent( Intent.ACTION_MAIN );
    i.setComponent(ComponentName.unflattenFromString( componentName ));
    i.addCategory( Intent.CATEGORY_LAUNCHER );
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity( i );
}