C# Project Using Android Lib. Help - Android Q&A, Help & Troubleshooting

I'm Trying To Make Android Anti Viruses Tool ...
I was Working with : "
Code:
System.Diagnostics.Process.Start(CMD);
"
But Androild Lib May Help Much more and Save my Time ...
the Point is .. I want to list the Directory : "/system/app " listview so I use this
Code:
String u;
if (android.HasConnectedDevices)
{
u = android.ConnectedDevices[0];
device = android.GetConnectedDevice(u);
Dir = device.FileSystem.GetFilesAndDirectories("//data//app").Values.ToString();
l.SubItems.Add(Dir);
listView2.Items.Add(l);
}
So The Result was This ! " Collection " in listview
what is the Current way to use this ?
Thank and Best Regards ! :good:

Related

[R&D] Upload files with DropBox

Hi, this is my code, i cant get upload a simple file:
Signgin in to DropBox:
.....private AccessTokenPair tokensDB;
.....private DropboxAPI<AndroidAuthSession> mDBApi;
.....final static private AccessType ACCESS_TYPE = AccessType.DROPBOX;
.....AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
.....AndroidAuthSession sesDropBox = new AndroidAuthSession(appKeys, ACCESS_TYPE);
.....mDBApi = new DropboxAPI<AndroidAuthSession>(sesDropBox);
.....mDBApi.getSession().startAuthentication(this);
When activity resums this code is executed:
.....mDBApi.getSession().finishAuthentication();
.....tokensDB = mDBApi.getSession().getAccessTokenPair();
when the user clicks over a button in same activity next code is executed:
protected void subeArchivos() {
.....// Uploading content.
.....String fileContents = "Hello World, this is only an example!!";
.....ByteArrayInputStream inputStream = new ByteArrayInputStream(fileContents.getBytes());
.....try {
..........mDBApi.putFile("/testing.txt", inputStream, fileContents.length(), null, null);
..........//Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
.....} catch (DropboxUnlinkedException e) {
..........// User has unlinked, ask them to link again here.
..........Log.e("DbExampleLog", "User has unlinked.");
.....} catch (DropboxException e) {
..........toast = Toast.makeText(getApplicationContext(), "C U A: " + e.getMessage(), Toast.LENGTH_SHORT);
..........toast.show();
..........//Log.e("DbExampleLog", "Something went wrong while uploading.");
.....}
}
The code in red throws error. and after the conde in yellow is executed.
My mnifiest permissions are:
.....<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
.....<uses-permission android:name="android.permission.INTERNET"></uses-permission>
.....<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"></uses-permission>
P.D. All works, exept code in red!!
I hope you can help me!! thx!!
anyone??
I didn't understand anything exc. that you can't upload any file with Dropbox, but I had similar problem. Seems you shouldn't delete the Downloads app, else it bugs DB uploads.
Hope it helps.
thx man, every folder in his place, but maybe something in my code is wrong!!

[Q] How to sign an app with system key (certificate)

Hi guys, I hope you can help me!
I have a Samsung i-9000 and i'm writing an application to enter the pin code of the SIM card if it has not already been done before.
I inserted android:sharedUserId="android.uid.system" in AndroidManifest.xml and this is the code in my Activity class:
Code:
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
try {
clazz = Class.forName(tm.getClass().getName());
m = clazz.getDeclaredMethod("getITelephony");
m.setAccessible(true);
it = (ITelephony)m.invoke(tm);
} catch(ClassNotFoundException e) {
Log.e("ClassNotFoundException", e.getMessage());
} catch(ClassCastException e) {
Log.e("ClassCastException", e.getMessage());
} catch(NoSuchMethodException e) {
Log.e("NoSuchMethodException", e.getMessage());
} catch(InvocationTargetException e) {
Log.e("InvocationTargetException", e.getMessage());
} catch(IllegalAccessException e) {
Log.e("IllegalAccessException", e.getMessage());
}
it.supplyPin(pin);
Now I know I have to sign my app with system certificate (or system key) to work with Android 2.3.3, but I don't how I can do it. I never signed an app before, especially as system app.
On google I found this for a Dream telephone:
- In the AndroidManifest.xml of your application: under the <manifest>
element add the attribute android:sharedUserId="android.uid.system".
- Export an unsigned version of your Android application using
Eclipse: right-click on the project >> Android Tools >> Export
Unsigned Application Package.
- Use <root-of-android-source-tree>/out/host/<your-host>/framework/
signapk.jar to sign your app using platform.x509.pem and platform.pk8
in <root-of-android-source-tree>/build/target/product/security
generated earlier: java -jar signapk.jar platform.x509.pem
platform.pk8 YourApp-unsigned.apk YourApp-signed.apk.
I don't understand the meaning of the last point!!!! What have I to do step by step?? Where is <root-of-android-source-tree>/out/host/<your-host>/framework/
signapk.jar file?? Where are platform.x509.pem and platform.pk8? It says "<root-of-android-source-tree>/build/target/product/security", but where is this path?
The setps above are for a Dream telephone, maybe there is something different in Samsung i9000?
I don't know if it could be useful, hower I have a rooted Samsung i-9000 with Darky 10.2 ROM, development tool: Eclipse, OS: Windows7 32bit
Thank you very much!!!!
There is a Dream system certificate made available by the manufacture somehow. Not all manufactures will make available of their system certificate. I too would like to make a system app myself. However, without having the apk signed by the handset system certificate, there is no way obtain system permissions. I was wondering if there is a way to add my own system certificate to my handset given that I have root access to the handset.

[DLL]Only For Mono-Droid Developers

Hey everyone, since we develop apps on Mono Android, I thought that if there were something that will easily help us to execute the commands. So I'm wrote a DLL which will be useful for anyone, though this will reduce a little bit of time while you developing apps.
Second Releasing:- Get Date
Get Time
Get a List of Files and Folders in a specific path
Previous Commands attached.
PS:- Fixed the Root Permissions. Now only Some Commands will require Root Permissions.
Initial Version:- Mount/Un-Mount System as RW/RO.
Set Permissions - Through this you can Set permissions to the files easily. -- SU cmd
Play Boot Animation - Show your BootAnime without rebooting your Device.
Reboot - Won't work on every rom. You must have reboot in your /system/bin/ -- SU cmd
UpTime - How much long the phone was Turned On Since The Last boot.
Example of Usings:-
Code:
[Activity(Label = "Testings", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
int count = 1;
MultiShell.ShellCmds shellCmds = new ShellCmds();
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById(Resource.Id.MyButton);
button.Click += button_Click;
TextView textView = FindViewById(Resource.Id.textView1);
textView.Text = cmdsShell.GetListofFilesnFolders("/system/bin/"); //Get a list of folders/files in a specific path.
textView.Text = cmdsShell.GetDate(); //Gets the date as a string.
cmdsShell.SetPermissions("0644","/system/etc/hw_config.sh");
}
Download MultiShellLatest.zip and Extract it then use the MultiShell.dll to program.
I Hope you will enjoy my work. Suggestions are Welcome.
HappY COding!
View attachment MultiShellLatest.zip
View attachment 2207630
--------------
----------—------——
Hey, cool. :good:
(This "limited to 8 thanks a day"... :laugh
nikwen said:
Hey, cool. :good:
(This "limited to 8 thanks a day"... :laugh
Click to expand...
Click to collapse
Lol...thanks man :beer:
Sent from my SonyX8 using Tapatalk 2
Next version will be updated soon.
There will be more few features with installing apks in background.
Sent from my SonyX8 using Tapatalk 2
.................
thank you, very nice tool to have
WarBorg said:
thank you, very nice tool to have
Click to expand...
Click to collapse
Hi, thanks for trying it. I will release a new version soon with some new features.
Sent from my E15 using xda app-developers app

[Q] How to get ReponseData and Signature for android LVL

Hi,
I try to implement a server side verification of an application with LVL library.
I use this php code : http://code.google.com/p/android-market-license-verification/
In the file sample/verify.php, I have two lines to complete :
Code:
$responseData = '';
$signature = '';
I see in the google LVL that there is a function called verify which has these parameters :
public void verify(PublicKey publicKey, int responseCode, String signedData, String signature);
But I don't undestand where this function is called and by what function.
Also I want to get this datas.
How can I do that ?
Thank you,
Yeah!! Same here!
Can someone tell us?
Most apps use client side license verification, don't know why... This would be very useful!

I cannot delete a file in Android 11

Hello,
I have an application that make photos into a subdirectory called "DesPictures" in Environment.DIRECTORY_DCIM public directory
Another application scan the "DesPictures" directory and delete the photos one by one.
In Android 10 the code is:
dir = new File (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + "/DesPictures");
File list[] = dir.listFiles();
if (list != null) {
for (int i = 0; i < list.length; i++) {
list.delete(); //WORKS IN Android 10 but DOES NOT WORK IN Android 11
}
}
Can anybody help me, please, in order to delete each list in Android 11? Thank you
The method, Environment.getExternalStoragePublicDirectory, was deprecated in API level 29 for security reasons.
An alternative is Context#getExternalFilesDir(String).

Categories

Resources