简体   繁体   中英

How to programatically create wifi connection os setting dialog

I want to design an app which shows a list of wifi networks available and it shows the wifi connection setting dialog box when it is selected. Can anyone please tell me how to do this?

Use AlarmManager. It allows you to send the intent in the specified time.

Intent startIntent = new Intent("WhatEverYouWant");
PendingIntent startPIntent = PendingIntent.getBroadcast(context, 0, startIntent, 0);
AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarm.set(AlarmManager.RTC_WAKEUP, triggerTime, startPIntent);

In manifest file add your receiver with appropriate action same as in the Intent. And from your receiver show the notification.

<receiver android:name="com.package.YourOnReceiver">
   <intent-filter>
       <action android:name="WhatEverYouWant" />
   </intent-filter>
</receiver>

More info on sending Intent using AlarmManager here
https://developer.android.com/reference/android/app/AlarmManager.html#set(int, long, android.app.PendingIntent)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM