android - Application have Only BroadcastReceiver is not working -
i have 1 callbroadcastreceiver extends broadcastreceiver , menifest declared.
still not showing toast while placing outgoing call. can please help?
its showing
[2016-02-27 10:02:20 - onlyreciever] no launcher activity found! [2016-02-27 10:02:20 - onlyreciever] launch sync application package on device!
code below -
callbroadcastreceiver.class
import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.widget.toast; /** * @author cosmos * */ public class callbroadcastreceiver extends broadcastreceiver { public callbroadcastreceiver() {} @override public void onreceive(context context, intent intent) { toast.maketext(context, intent.getaction(), toast.length_long).show(); } }
manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ind.example.onlyreciever" android:versioncode="1" android:versionname="1.0" > <uses-permission android:name="android.permission.process_outgoing_calls" /> <uses-sdk android:minsdkversion="22" android:targetsdkversion="22" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <receiver android:name="ind.example.onlyreciever.callbroadcastreceiver" android:enabled="true" android:exported="true" > <intent-filter> <action android:name="android.intent.action.new_outgoing_call" /> </intent-filter> </receiver> </application> </manifest>
for android 3.1 , higher,
you have launch 1 of activities app out of stopped state before manifest-registered broadcastreceiver work, detailed in 3.1 release notes.
when app first installed or manually force-closed, in "stopped state". in state, broadcast intents flag_include_stopped_packages flag reach broadcast receivers; flag not included in default system broadcasts, app cannot receive them in stopped state.
note "stopped state" tracked package manager , not same "application not running". once app out of stopped state, remain if reboot device , app not running.
Comments
Post a Comment