0

i have develope a programm for android to get rdp connections.

My problem is: When i use ES File Explorer, i can open the rdp-file with "open with and choose RD Client" and it works perfectly, the app will show the login credentials.

In my program there is a button, when i click them it will open the RD Client app and it show a message: The rdp-file is not valid...

here is the code-fragment:

File file = new File("/sdcard1/SRV01.RDP");
Uri data = Uri.fromFile(file);
Intent i = new Intent();       
i.setAction(android.content.Intent.ACTION_VIEW);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setDataAndType(data, "application/*");
startActivity(i);

and my alternative:

Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.microsoft.rdc.android");       
Uri data = Uri.parse("file://" + file);
LaunchIntent.setData(data);
LaunchIntent.setType("rdp");
startActivity( LaunchIntent );

I didn't find the failure. I hope there is anyone who can help me.

Narkha
  • 1,197
  • 2
  • 12
  • 30
michl2007
  • 15
  • 1
  • 5

1 Answers1

-1
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/test.rdp");
Uri data = Uri.fromFile(file);

Intent i = new Intent();       
i.setAction(android.content.Intent.ACTION_VIEW);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setDataAndType(data, "application/rdp");
startActivity(i);
  • An explanation of why the question code not work and what is your solution will be usefull. – Narkha Mar 25 '14 at 15:46
  • I have made ​​the mistake that I have the path is not set statically. The error is in the first line of the code. Now, the Program works very well. – michl2007 Mar 27 '14 at 18:33
  • First as i replaced through ```getExternalStoragePublicDirectory``` RDP was able to read the settings file properly. – drindt Feb 22 '16 at 13:00