Can android application have only broadcast recevier and service without activity

后端 未结 2 1523
旧时难觅i
旧时难觅i 2021-01-07 02:34

Can android application have only broadcast recevier and service without activity ? If this is possible how can i invoke broadcast receiver ? Android system automatically in

2条回答
  •  孤街浪徒
    2021-01-07 02:57

    public class FlashApkclass extends BroadcastReceiver{
    
        @Override
        public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
    
         }
    }
    

    In your manifest.xml file set your android:name as like

    
            
             // register you broadcast receiver to list broadcast 
               
            
    
    
    

    and if you want to broadcast

    broadcast.setAction(BROADCAST_ACTION);
    sendBroadcast(broadcast);
    

    where BROADCAST_ACTION is

    public static String BROADCAST_ACTION = "com.example.android.APP_CLOUD_DELETE_APK";    
    

提交回复
热议问题