Click here to Skip to main content
15,885,546 members
Home / Discussions / Android
   

Android

 
AnswerRe: Alarm Manager Pin
Richard MacCutchan29-Jan-17 2:01
mveRichard MacCutchan29-Jan-17 2:01 
GeneralRe: Alarm Manager Pin
Pavlex429-Jan-17 2:13
Pavlex429-Jan-17 2:13 
GeneralRe: Alarm Manager Pin
Richard MacCutchan29-Jan-17 2:18
mveRichard MacCutchan29-Jan-17 2:18 
GeneralRe: Alarm Manager Pin
Afzaal Ahmad Zeeshan29-Jan-17 2:22
professionalAfzaal Ahmad Zeeshan29-Jan-17 2:22 
GeneralRe: Alarm Manager Pin
Richard MacCutchan29-Jan-17 2:47
mveRichard MacCutchan29-Jan-17 2:47 
GeneralRe: Alarm Manager Pin
Afzaal Ahmad Zeeshan29-Jan-17 3:07
professionalAfzaal Ahmad Zeeshan29-Jan-17 3:07 
AnswerRe: Alarm Manager Pin
Afzaal Ahmad Zeeshan29-Jan-17 2:20
professionalAfzaal Ahmad Zeeshan29-Jan-17 2:20 
GeneralRe: Alarm Manager Pin
Pavlex429-Jan-17 3:40
Pavlex429-Jan-17 3:40 
Now when I launch it shows otg not connected and it's repeating it many times and when I plug in otg cable it's still repeating "otg not connected" and after some time it shows "otg connected" !!!!

When I start app it shouldn't show anything, it should only show when I plug in or when I plug out otg cable.And it shouldn't repeat same message many times !!!!

Java
public class AlarmReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context,Intent intent)
    {

        File directory = new File("/sys/bus/usb/devices");
        File[] contents = directory.listFiles();

        if(contents.length == 0)
        {
            Toast.makeText(context,"otg not connected",Toast.LENGTH_SHORT).show();
        }
        else
        {
            Toast.makeText(context,"otg connected",Toast.LENGTH_SHORT).show();
        }
    }
}


modified 29-Jan-17 9:54am.

AnswerRe: Alarm Manager Pin
Afzaal Ahmad Zeeshan29-Jan-17 3:56
professionalAfzaal Ahmad Zeeshan29-Jan-17 3:56 
GeneralRe: Alarm Manager Pin
Pavlex429-Jan-17 4:00
Pavlex429-Jan-17 4:00 
GeneralRe: Alarm Manager Pin
Pavlex429-Jan-17 4:54
Pavlex429-Jan-17 4:54 
AnswerRe: Alarm Manager Pin
David Crow30-Jan-17 10:25
David Crow30-Jan-17 10:25 
GeneralRe: Alarm Manager Pin
Pavlex430-Jan-17 10:40
Pavlex430-Jan-17 10:40 
AnswerRe: Alarm Manager Pin
David Crow30-Jan-17 16:50
David Crow30-Jan-17 16:50 
GeneralRe: Alarm Manager Pin
Pavlex431-Jan-17 10:48
Pavlex431-Jan-17 10:48 
SuggestionRe: Alarm Manager Pin
David Crow31-Jan-17 17:23
David Crow31-Jan-17 17:23 
GeneralRe: Alarm Manager Pin
Pavlex431-Jan-17 20:22
Pavlex431-Jan-17 20:22 
QuestionRe: Alarm Manager Pin
David Crow1-Feb-17 2:14
David Crow1-Feb-17 2:14 
QuestionAndroid OTG Detect App Pin
Pavlex427-Jan-17 10:54
Pavlex427-Jan-17 10:54 
AnswerRe: Android OTG Detect App Pin
Richard MacCutchan27-Jan-17 22:05
mveRichard MacCutchan27-Jan-17 22:05 
QuestionSimple HTTP Post Request - application/json Pin
Django_Untaken27-Jan-17 9:21
Django_Untaken27-Jan-17 9:21 
AnswerRe: Simple HTTP Post Request - application/json Pin
Richard MacCutchan27-Jan-17 22:03
mveRichard MacCutchan27-Jan-17 22:03 
QuestionAndroid USB Detection Pin
Pavlex421-Jan-17 11:18
Pavlex421-Jan-17 11:18 
AnswerRe: Android USB Detection Pin
Afzaal Ahmad Zeeshan21-Jan-17 12:28
professionalAfzaal Ahmad Zeeshan21-Jan-17 12:28 
GeneralRe: Android USB Detection Pin
Pavlex421-Jan-17 12:53
Pavlex421-Jan-17 12:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.